﻿ZEUS.TIME = {
    getHourAPM: function (time, sep) {
        var hour = time.getHours();
        var am_pm;
        if (hour < 12) {
            am_pm = 'am';
        } else {
            am_pm = 'pm';
        }
        hour = hour % 12;
        if (hour==0) {
            hour = 12;
        }
        return hour + sep + am_pm;
    },
    getTimeAPM: function (tm, secs) {
        var sep = ':'; //separator character
        var hours, minutes, seconds, time, am_pm;
        //var now = new Date();
        hours = tm.getHours();
        if (hours < 12) {
            am_pm = 'am';
        } else {
            am_pm = 'pm';
        }
        hours = hours % 12;
        if (hours === 0) {
            hours = 12;
        }
        time = hours;
        minutes = tm.getMinutes();
        if (minutes < 10) {
            minutes = '0' + minutes;
        }
        time += sep + minutes;
        if (secs) {
            seconds = tm.getSeconds();
            if (seconds < 10) {
                seconds = '0' + seconds;
            }
            time += sep + seconds;
        }
        return time + ' ' + am_pm;
    }
};